﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using Fiveesoft.Utility;
using NLUNZ.Admin;
using NLUNZ.Business;
using Telerik.Web.UI;

namespace NLUNZ.UserControls
{
    public partial class NoticeBoardProperty : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }


        protected void btnAddNB_Click(object sender, EventArgs e)
        {

            string notice = txtNB.Text;
            if (notice.Trim().Length == 0)
                return;

            NoticeBoard nb = new NoticeBoard();
            if(notice.Length > 250)
            {
                nb.Title = notice.Substring(0, 250);
            }else
            {
                nb.Title = notice;
            }
            nb.Content = notice;
            nb.CreateDate = DateTime.UtcNow.AddHours(Utility.TimeZone());
            MessageBag bag = Repository.InsertNoticeBoardItem(nb);
            if(bag.Verified)
            {
                txtNB.Text = "";
                GridView1.DataSourceID = "LinqDataSource1";
                GridView1.DataBind();
            }


        }

    }
}